package api

import (
	"github.com/gin-gonic/gin"
	"hcy-go/global/structs/table"
	"hcy-go/lib/response"
	"hcy-go/modules/system/service"
)

type userApi struct {
}

var UserApi = new(userApi)

func (a userApi) Add(c *gin.Context) {
	var in table.User
	if err := c.ShouldBindJSON(&in); err != nil {
		response.BadWithParamsError(c)
		return
	}
	err := service.UserService.Create(in)
	if err != nil {
		response.BadWithParamsError(c)
	}
	response.OK204(c)
}
